<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Module: Entropy
  
    &mdash; FSelector Documentation
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (E)</a> &raquo; 
    
    
    <span class="title">Entropy</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Module: Entropy
  
  
  
</h1>

<dl class="box">
  
  
    
  
    
  
  
    <dt class="r1">Included in:</dt>
    <dd class="r1"><span class='object_link'><a href="Discretizer.html" title="Discretizer (module)">Discretizer</a></span>, <span class='object_link'><a href="FSelector/CFS_d.html" title="FSelector::CFS_d (class)">FSelector::CFS_d</a></span>, <span class='object_link'><a href="FSelector/FastCorrelationBasedFilter.html" title="FSelector::FastCorrelationBasedFilter (class)">FSelector::FastCorrelationBasedFilter</a></span>, <span class='object_link'><a href="FSelector/INTERACT.html" title="FSelector::INTERACT (class)">FSelector::INTERACT</a></span>, <span class='object_link'><a href="FSelector/InformationGain.html" title="FSelector::InformationGain (class)">FSelector::InformationGain</a></span>, <span class='object_link'><a href="FSelector/KS_CCBF.html" title="FSelector::KS_CCBF (class)">FSelector::KS_CCBF</a></span>, <span class='object_link'><a href="FSelector/SymmetricalUncertainty.html" title="FSelector::SymmetricalUncertainty (class)">FSelector::SymmetricalUncertainty</a></span></dd>
    
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/fselector/entropy.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>entropy-related functions for discrete data</p>

<p>ref: <a href="http://en.wikipedia.org/wiki/Mutual_information">Wikipedia</a></p>


  </div>
</div>
<div class="tags">
  

</div>






  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_conditional_entropy-instance_method" title="#get_conditional_entropy (instance method)">- (Float) <strong>get_conditional_entropy</strong>(vecX, vecY) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>get the conditional entropy of vector (X) given another vector (Y).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_information_gain-instance_method" title="#get_information_gain (instance method)">- (Float) <strong>get_information_gain</strong>(vecX, vecY) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>get the information gain of vector (X) given another vector (Y).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_joint_entropy-instance_method" title="#get_joint_entropy (instance method)">- (Float) <strong>get_joint_entropy</strong>(vecX, vecY) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>get the joint entropy of vector (X) and vector (Y).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_marginal_entropy-instance_method" title="#get_marginal_entropy (instance method)">- (Float) <strong>get_marginal_entropy</strong>(vecX) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>get the marginal entropy of vector (X).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_symmetrical_uncertainty-instance_method" title="#get_symmetrical_uncertainty (instance method)">- (Float) <strong>get_symmetrical_uncertainty</strong>(vecX, vecY) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>get the symmetrical uncertainty of vector (X) and vector (Y).</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="get_conditional_entropy-instance_method">
  
    - (<tt>Float</tt>) <strong>get_conditional_entropy</strong>(vecX, vecY) 
  

  
</p><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong> 
    <div class='inline'><p>vecX and vecY must be of same length</p>
</div>
  </div>

<p>get the conditional entropy of vector (X) given another vector (Y)</p>

<pre class="code ruby"><code>H(X|Y) = sigma_j (P(y_j) * H(X|y_j))

where H(X|y_j) = -1 * sigma_i (P(x_i|y_j) log2 P(x_i|y_j))
</code></pre>


  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='name'>vecX</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the first vector</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>vecY</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the second vector</p>
</div>
      
    </li>
  
</ul>

<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>H(X|Y)</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/fselector/entropy.rb', line 38</span>

<span class='kw'>def</span> <span class='id identifier rubyid_get_conditional_entropy'>get_conditional_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='comma'>,</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='kw'>__FILE__</span><span class='rbrace'>}</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='kw'>__LINE__</span><span class='rbrace'>}</span><span class='tstring_content'>]: \n</span><span class='tstring_end'>&quot;</span></span><span class='op'>+</span>
        <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>  two vectors must be of same length</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_vecX'>vecX</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>

  <span class='id identifier rubyid_hxy'>hxy</span> <span class='op'>=</span> <span class='float'>0.0</span>
  <span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='id identifier rubyid_vecX'>vecX</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>

  <span class='id identifier rubyid_vecY'>vecY</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_y_j'>y_j</span><span class='op'>|</span>
    <span class='id identifier rubyid_p1'>p1</span> <span class='op'>=</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='lparen'>(</span><span class='id identifier rubyid_y_j'>y_j</span><span class='rparen'>)</span><span class='op'>/</span><span class='id identifier rubyid_n'>n</span>

    <span class='id identifier rubyid_indices'>indices</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='int'>0</span><span class='op'>...</span><span class='id identifier rubyid_n'>n</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='op'>|</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_y_j'>y_j</span> <span class='rbrace'>}</span>
    <span class='id identifier rubyid_xvs'>xvs</span> <span class='op'>=</span> <span class='id identifier rubyid_vecX'>vecX</span><span class='period'>.</span><span class='id identifier rubyid_values_at'>values_at</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_indices'>indices</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_m'>m</span> <span class='op'>=</span> <span class='id identifier rubyid_xvs'>xvs</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>

    <span class='id identifier rubyid_xvs'>xvs</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_x_i'>x_i</span><span class='op'>|</span>
      <span class='id identifier rubyid_p2'>p2</span> <span class='op'>=</span> <span class='id identifier rubyid_xvs'>xvs</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='lparen'>(</span><span class='id identifier rubyid_x_i'>x_i</span><span class='rparen'>)</span><span class='op'>/</span><span class='id identifier rubyid_m'>m</span>

      <span class='id identifier rubyid_hxy'>hxy</span> <span class='op'>+=</span> <span class='op'>-</span><span class='float'>1.0</span> <span class='op'>*</span> <span class='id identifier rubyid_p1'>p1</span> <span class='op'>*</span> <span class='lparen'>(</span><span class='id identifier rubyid_p2'>p2</span> <span class='op'>*</span> <span class='const'>Math</span><span class='period'>.</span><span class='id identifier rubyid_log2'>log2</span><span class='lparen'>(</span><span class='id identifier rubyid_p2'>p2</span><span class='rparen'>)</span><span class='rparen'>)</span>
    <span class='kw'>end</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_hxy'>hxy</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="get_information_gain-instance_method">
  
    - (<tt>Float</tt>) <strong>get_information_gain</strong>(vecX, vecY) 
  

  
</p><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong> 
    <div class='inline'><p>vecX and vecY must be of same length</p>
</div>
  </div>

<p>get the information gain of vector (X) given another vector (Y)</p>

<pre class="code ruby"><code>IG(X;Y) = H(X) - H(X|Y)
        = H(Y) - H(Y|X) = IG(Y;X)
</code></pre>


  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='name'>vecX</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the first vector</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>vecY</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the second vector</p>
</div>
      
    </li>
  
</ul>

<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>IG(X;Y)</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


92
93
94</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/fselector/entropy.rb', line 92</span>

<span class='kw'>def</span> <span class='id identifier rubyid_get_information_gain'>get_information_gain</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='comma'>,</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_get_marginal_entropy'>get_marginal_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='rparen'>)</span> <span class='op'>-</span> <span class='id identifier rubyid_get_conditional_entropy'>get_conditional_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='comma'>,</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="get_joint_entropy-instance_method">
  
    - (<tt>Float</tt>) <strong>get_joint_entropy</strong>(vecX, vecY) 
  

  
</p><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong> 
    <div class='inline'><p>vecX and vecY must be of same length</p>
</div>
  </div>

<p>get the joint entropy of vector (X) and vector (Y)</p>

<pre class="code ruby"><code>H(X,Y) = H(Y) + H(X|Y)
       = H(X) + H(Y|X)

i.e. H(X,Y) == H(Y,X)
</code></pre>


  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='name'>vecX</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the first vector</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>vecY</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the second vector</p>
</div>
      
    </li>
  
</ul>

<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>H(X,Y)</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


76
77
78</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/fselector/entropy.rb', line 76</span>

<span class='kw'>def</span> <span class='id identifier rubyid_get_joint_entropy'>get_joint_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='comma'>,</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_get_marginal_entropy'>get_marginal_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_get_conditional_entropy'>get_conditional_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='comma'>,</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="get_marginal_entropy-instance_method">
  
    - (<tt>Float</tt>) <strong>get_marginal_entropy</strong>(vecX) 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>get the marginal entropy of vector (X)</p>

<pre class="code ruby"><code>H(X) = -1 * sigma_i (P(x_i) log2 P(x_i))
</code></pre>


  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='name'>vecX</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>vector of interest</p>
</div>
      
    </li>
  
</ul>

<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>H(X)</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


14
15
16
17
18
19
20
21
22
23
24</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/fselector/entropy.rb', line 14</span>

<span class='kw'>def</span> <span class='id identifier rubyid_get_marginal_entropy'>get_marginal_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='float'>0.0</span>
  <span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='id identifier rubyid_vecX'>vecX</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>

  <span class='id identifier rubyid_vecX'>vecX</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_x_i'>x_i</span><span class='op'>|</span>
    <span class='id identifier rubyid_p'>p</span> <span class='op'>=</span> <span class='id identifier rubyid_vecX'>vecX</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='lparen'>(</span><span class='id identifier rubyid_x_i'>x_i</span><span class='rparen'>)</span><span class='op'>/</span><span class='id identifier rubyid_n'>n</span>
    <span class='id identifier rubyid_h'>h</span> <span class='op'>+=</span> <span class='op'>-</span><span class='float'>1.0</span> <span class='op'>*</span> <span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span> <span class='op'>*</span> <span class='const'>Math</span><span class='period'>.</span><span class='id identifier rubyid_log2'>log2</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='rparen'>)</span><span class='rparen'>)</span>
  <span class='kw'>end</span>

  <span class='id identifier rubyid_h'>h</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="get_symmetrical_uncertainty-instance_method">
  
    - (<tt>Float</tt>) <strong>get_symmetrical_uncertainty</strong>(vecX, vecY) 
  

  
</p><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong> 
    <div class='inline'><p>vecX and vecY must be of same length</p>
</div>
  </div>

<p>get the symmetrical uncertainty of vector (X) and vector (Y)</p>

<pre class="code ruby"><code>                 IG(X;Y)
SU(X;Y) = 2 * -------------
                H(X) + H(Y)

               H(X) - H(X|Y)         H(Y) - H(Y|X)
        = 2 * --------------- = 2 * --------------- = SU(Y;X)
                H(X) + H(Y)           H(X) + H(Y)
</code></pre>


  </div>
</div>
<div class="tags">
  <h3>Parameters:</h3>
<ul class="param">
  
    <li>
      
        <span class='name'>vecX</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the first vector</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>vecY</span>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>the second vector</p>
</div>
      
    </li>
  
</ul>

<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Float</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'><p>SU(X;Y)</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


113
114
115
116
117
118
119
120
121
122</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/fselector/entropy.rb', line 113</span>

<span class='kw'>def</span> <span class='id identifier rubyid_get_symmetrical_uncertainty'>get_symmetrical_uncertainty</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='comma'>,</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span>  
  <span class='id identifier rubyid_hx'>hx</span> <span class='op'>=</span> <span class='id identifier rubyid_get_marginal_entropy'>get_marginal_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_hxy'>hxy</span> <span class='op'>=</span> <span class='id identifier rubyid_get_conditional_entropy'>get_conditional_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecX'>vecX</span><span class='comma'>,</span> <span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_hy'>hy</span> <span class='op'>=</span> <span class='id identifier rubyid_get_marginal_entropy'>get_marginal_entropy</span><span class='lparen'>(</span><span class='id identifier rubyid_vecY'>vecY</span><span class='rparen'>)</span>
  
  <span class='id identifier rubyid_su'>su</span> <span class='op'>=</span> <span class='float'>0.0</span>
  <span class='id identifier rubyid_su'>su</span> <span class='op'>=</span> <span class='int'>2</span><span class='op'>*</span><span class='lparen'>(</span><span class='id identifier rubyid_hx'>hx</span><span class='op'>-</span><span class='id identifier rubyid_hxy'>hxy</span><span class='rparen'>)</span><span class='op'>/</span><span class='lparen'>(</span><span class='id identifier rubyid_hx'>hx</span><span class='op'>+</span><span class='id identifier rubyid_hy'>hy</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='kw'>not</span> <span class='lparen'>(</span><span class='id identifier rubyid_hx'>hx</span><span class='op'>+</span><span class='id identifier rubyid_hy'>hy</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_zero?'>zero?</span>
  
  <span class='id identifier rubyid_su'>su</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Mon Nov  5 11:19:44 2012 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.5 (ruby-1.9.3).
</div>

  </body>
</html>